/***************************************************************************
 *   Copyright (C) 2008 by Ryszard Krol,   *
 *   rysiek.krol@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef REXIFDATA_H
#define REXIFDATA_H

#include <QString>
#include <QDateTime>
#include <QImage>

#include <exiv2/image.hpp>
#include <exiv2/exif.hpp>

#include <QList>
#include <QTreeWidgetItem>

/**
*	@author Ryszard Krol <rysiek.krol@gmail.com>
*
*	Klasa Wczytuje i przechowuje dane EXIF z pliku graficznego
*/
class RExifData
{
	public:

		RExifData ( char* filePath );
		RExifData ( QString *filePath );
		~RExifData();
		bool isExif();
		QDateTime getDate();
		QImage getThumbnail();
		void writeData();
                QList<QTreeWidgetItem *> * getExifTree();

	private:
		Exiv2::ExifData exifData;
		Exiv2::Image::AutoPtr image;
		QDateTime date;
		QImage thumbnail;
		QString filePathString;
		bool isNull;
		void extractDateTime();
		void extractThumbnail();
		void refreshImageThumbnail();
		bool isKeyExist(std::string key);

                QTreeWidgetItem * groupExists(std::string groupName, QList<QTreeWidgetItem *> *list);

};

#endif
